package com.essence.grabiec104.grab.model;

import lombok.Data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class CycleQuery {
    private int setValuesSize;
    private List<String> categories = new ArrayList<>();
    private Map<String, List<Double>> setValues = new HashMap<>();

    /**
     * @brief 添加一个类别
     * @details 如果类别已经存在，则不添加，并且在setValues中添加一个空的List
     */
    public void addCategory(String category) {
        if (categories.contains(category)) {
            return;
        }
        categories.add(category);
        setValues.put(category, new ArrayList<>());
        setValuesSize++;
    }

    public void pushSetValue(String category, double... value) {
        if (!categories.contains(category)) {
            return;
        }
        for(double v : value) {
            setValues.get(category).add(v);
        }
    }
}
